local hx__realjwdj = fk.CreateSkill {
  name = "hx__realjwdj",
}

hx__realjwdj:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(hx__realjwdj.name) and #Card:getIdList(data.card) ~= 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, hx__realjwdj.name)
    local success, dat = room:askToUseActiveSkill(player, {
      skill_name = "hx__realjwdj_viewas",
      prompt = "#hx__realjwdj-use",
      cancelable = true,
      extra_data = { bypass_times = true },
    })
    if dat then
      local cards = dat.cards
      local extra_data = dat.targets
      local card = Fk:cloneCard(Fk:getCardById(cards[1]).name)
      card.skillName = hx__realjwdj.name
      player:showCards(cards)
      local mark = player:getTableMark("@$hx__realjwdj-turn") or {}
      table.insert(mark, card.name)
      room:setPlayerMark(player, "@$hx__realjwdj-turn", mark)
      room:useCard{
        from = player,
        tos = extra_data,
        card = card,
      }
    end
  end,
})

return hx__realjwdj
